package com.qfedu.controller;

import com.qfedu.entity.Cargoreceiptdetail;
import com.qfedu.entity.Goodsbill;
import com.qfedu.service.GoodsBillService;
import com.qfedu.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName: logistics
 *
 * @author: CGY
 * time: 2020-10-7 20:49
 * description:
 */
@RestController
@RequestMapping("/goodsBill")
public class GoodsBillController {

    @Autowired
    private GoodsBillService goodsBillService;

    @RequestMapping("/add.do")
    public Result add(Goodsbill goodsbill){
        return goodsBillService.add(goodsbill);
    }


    @RequestMapping("/addGoods.do")
    public Result addGoods(Cargoreceiptdetail cargoreceiptdetail){
        return  goodsBillService.addGoods(cargoreceiptdetail);
    }


    @RequestMapping("/selectByEvent.do")
    public Result selectByEvent(String eventName){
        return goodsBillService.selectByEvent(eventName);
    }

    @RequestMapping("/selectByCode.do")
    public Result selectByCode(String goodsBillCode){
        return goodsBillService.selectByCode(goodsBillCode);
    }

    @RequestMapping("/updateByCode.do")
    public Result updateByCode(Goodsbill goodsbill){
        System.out.println("goodsbill = " + goodsbill);
        return goodsBillService.update(goodsbill);
    }

    @RequestMapping("/deleteByCode.do")
    public Result deleteByCode(String goodsBillId){
        return Result.success("成功");
    }
}
